﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Enterprise.Core;
using System.Collections;
using System.Data.Linq;
using System.Linq.Expressions;
namespace Enterprise.Business
{
    public abstract class BusinessBase<TEntity> //: IBusinessEntity //where TEntity : class
    {
        //Copy
        public abstract void Copy(TEntity source, TEntity target);
        public abstract void Copy(TEntity source, TEntity target, bool detach);
        // Delete
        public abstract void Delete();
        public abstract void DeleteById(Int32 id, bool commitOnDeleted);
        public abstract void DeleteByQuery<TEntity>(Expression<Func<TEntity, bool>> wherePredicate, bool physicalDeletion) where TEntity : class;
        //Insert
        public abstract void Insert();
        public abstract void Insert(TEntity entity);
        //Update
        public abstract void Update();
        public abstract void Update(TEntity entity);
        //Select
        public abstract List<TEntity> GetAll();
        public abstract IEnumerable Retrieve(int startRowIndex, int maximumRows, string sortExpression, string selector, string query, params object[] parameterValues);
        public abstract TEntity GetByID(Int32 id);
       //Undeleted
        public abstract void Undelete<TEntity>(TEntity entity) where TEntity : class;
        //Exists
        public abstract bool Exists<TEntity>(Expression<Func<TEntity, bool>> wherePredicate, bool includeDeleted) where TEntity : class;
        public abstract int GetCount<TEntity>(Expression<Func<TEntity, bool>> wherePredicate, bool includeDeleted) where TEntity : class;
        //
        //public virtual DataContext Context { get; set; }
        public abstract Int32 Id { get; set; }

        DateTime InsAt { get; set; }
        string InsBy { get; set; }
        
        bool IsDeleted { get; set; }
        DateTime UpdAt { get; set; }
        string UpdBy { get; set; }
    }
}
